﻿using IMark.DAO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace IMark.UC
{
    public partial class DanhMucBaiVietCtrl : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                List<LOAI_BAI_VIET> ltLoaiBaiViet = TinTucModels.LayTatCaDanhMucBaiViet();
                LoaiBaiVietContent.InnerHtml = GenerateLoaiBaiViet(ltLoaiBaiViet);
            }
            
        }

        private string GenerateLoaiBaiViet(List<LOAI_BAI_VIET> ltLoaiBaiViet)
        {
            StringBuilder str = new StringBuilder();
            for (int i = 0; i < ltLoaiBaiViet.Count; i++)
			{
                str.Append("<li class='item'> <a href='TinTuc.aspx?IDLoaiBV=" + ltLoaiBaiViet[i].ID + "'>" + ltLoaiBaiViet[i].Ten + "</a></li>");
			}
            return str.ToString();
        }
    }
}